<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.bootcdn.net/ajax/libs/react/18.0.0/cjs/react-jsx-dev-runtime.production.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/babel-core/6.1.9/browser.min.js"></script>
    <title>Document</title>
</head>
<body>
    <div id="example1"></div>
    <div id="example2"></div>
    <script>
        function MyComponent(){
            return <h2>函数组件</h2>
        }

        class MyComponent2 extends React.Component{
            render(){
                console.log(this)
                return <h2>类组件</h2>
            }
        }

        ReactDom.render(<MyComponent/>,document.getElementById("example1"))
        ReactDom.render(<MyComponent2/>,document.getElementById("example2"))
    </script>
</body>
</html>